package advanced.datastructure;

public class Student {

	private String name;
	private String fullAddress; //full address including the apt number
	private long campusPhoneNum;
	private int suBox;
	private long homePhoneNum;
	public final String UNKNOWN_ADDR="UNKNOWN";
    
	// Be sure to include a toString method here.
    public String toString() {
    	return name+"\n"+fullAddress+"\n"+campusPhoneNum+" "+suBox+" "+homePhoneNum+"\n"+"------------\n";
    }
    
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getFullAddress() {
		return fullAddress;
	}

	public void setFullAddress(String address) {
		this.fullAddress = address;
	}


	public long getCampusPhoneNum() {
		return campusPhoneNum;
	}

	public void setCampusPhoneNum(long campusPhoneNum) {
		this.campusPhoneNum = campusPhoneNum;
	}

	public int getSuBox() {
		return suBox;
	}

	public void setSuBox(int suBox) {
		this.suBox = suBox;
	}

	public long getHomePhoneNum() {
		return homePhoneNum;
	}

	public void setHomePhoneNum(long homePhoneNum) {
		this.homePhoneNum = homePhoneNum;
	}
	
	public int getVowelCountsInName()
	{
		String name = getName().toLowerCase();
		int vowelCount = 0;
		for (int i = 0; i < name.length(); i++) {
		    switch(name.charAt(i)) {
		        case 'a':
		        case 'e':
		        case 'i':
		        case 'o':
		        case 'u':
		            vowelCount++;
		            break;
		        default:
		    }
		}
		return vowelCount;
	}
	
	//Get the address without the apt number
	public String getAddress()
	{
		String address="";
		if(fullAddress.equals(UNKNOWN_ADDR))
		{
			return fullAddress;
		}
		
		String addressArr[] = fullAddress.split("\\s+");
    	if(addressArr.length==2)
    	{
    		return addressArr[0];
    	}
    	else if(addressArr.length==3)
    	{
    		return addressArr[0]+" "+addressArr[1];
    	}
		
		return address;
	}

}
